var oldLoadingPercent=0;
document.write("" +
    "<div id='loadingBarLabel'>" +
    "<div id='loading_label'><\/div>"+
    // "<div class='loading_bg'>"+
    // "<div id='loading_bar'><\/div></div>"+
    "<\/div>"

);
document.documentElement.style.setProperty('--barColor', LOADING_STYLE.info.bar.c);
document.documentElement.style.setProperty('--barBgColor', LOADING_STYLE.info.bar.bg_c);

if(LOADING_STYLE.type != "Default" ){
    document.documentElement.style.setProperty('--bar-pos_y', "55%");
}
//console.log(LOADING_STYLE.info.bar.c);
/*
* init_per = 初始占位比例（小数表示）,to_per=总共进度比例（小数表示）
* */
function onProgress(evt,init_per,to_per){
    if(init_per == undefined){
        init_per = 0;
    }
    if(to_per == undefined){
        to_per = 1;
    }
    var real_loaded = evt.progress * to_per;
    var loadedPer = Math.floor(real_loaded*100);
    // var loadingBar = document.getElementById("loading_bar");
    // if(loadingBar){
    //     loadingBar.style.width = (init_per * 100 + loadedPer)+"%";
    // }
    var loadingLabel = document.getElementById("loading_label");
    if(loadingLabel && LOADING_STYLE.info){
        if(LOADING_STYLE.info.label){
            var str = LOADING_STYLE.info.label.txt;
            // console.log(loadedPer+init_per * 100)
            str = str.replace(/%percent%/,(loadedPer+init_per * 100)+"%");
            if(loaderPage){
                loaderPage.draw_number((loadedPer+init_per * 100));
            }
            // console.log((loadedPer+init_per * 100),init_per);
            if(!loading_page.open){
                loadingLabel.innerHTML = str;
            }
        }
    }
    var bar_label = document.getElementById("loadingBarLabel");
    if(bar_label && LOADING_STYLE.info){
        if(!loading_page.open){
            bar_label.style.visibility = "visible";
        }
    }
    var loading_hold = document.getElementById("loading_hold");
    if(loading_hold && LOADING_STYLE.type!="default"){
        //console.log(loading_hold.style.visibility)
        if(!loading_page.open){
            loading_hold.style.visibility = "visible";
        }
    }
}

function onComplete(evt){
     All_length.push(1);//加载完成的总次数
        // var ctime=(new Date()).valueOf();
        // if(ctime-preload_start_time>3000){
        //     LAND_PAGE.resetAnimation();
        // }
        
        oldLoadingPercent=0;
        var loading_hold = document.getElementById("loading_hold");
        if(loading_hold){
            loading_hold.style.visibility = "hidden";
        }
        var bar_label = document.getElementById("loadingBarLabel");
        if(bar_label){
            bar_label.style.visibility = "hidden";
        }
}
